//引入Vue
import Vue from 'vue'
//引入App
import App from './App.vue'
// 引入路由
import VueRouter from 'vue-router'
import router from './router'
// 引入Vuex的仓库
import store from './store'
// 引入elementUI
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'

axios.defaults.baseURL='http://117.78.4.242/api'
//关闭Vue的生产提示
Vue.config.productionTip = false
//使用路由
Vue.use(VueRouter)
// 使用ElementUI
Vue.use(ElementUI) 

//前置token
axios.interceptors.request.use(config => {
    console.log(config);
    config.headers.Authorization = localStorage.getItem('token');
    // 在最后必须return config
    return config;
});

//创建vm
new Vue({
	el:'#app',
	render: h => h(App),
	router:router,
	store:store,
	beforeCreate() {
		// 全局事件总线
		Vue.prototype.$bus = this
		Vue.prototype.$axios=axios
	},
})